<%@ page import="java.util.*" language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>标签管理系统 - 首页</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <!-- basic styles -->
    <link href="${basePath}/ACE/css/bootstrap.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="${basePath}/ACE/css/font-awesome.min.css" />
    <!--[if IE 7]>
		  <link rel="stylesheet" href="${basePath}/ACE/css/font-awesome-ie7.min.css" />
		<![endif]-->
    <!-- page specific plugin styles -->
    <!-- fonts -->
    <!-- ace styles -->
    <link rel="stylesheet" href="${basePath}/ACE/css/ace.min.css" />
    <link rel="stylesheet" href="${basePath}/ACE/css/ace-rtl.min.css" />
    <link rel="stylesheet" href="${basePath}/ACE/css/ace-skins.min.css" />
    <!--[if lte IE 8]>
		  <link rel="stylesheet" href="${basePath}/ACE/css/ace-ie.min.css" />
		<![endif]-->
    <!-- inline styles related to this page -->
    <!-- ace settings handler -->
    <script src="${basePath}/ACE/js/ace-extra.min.js"></script>
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
		<script src="${basePath}/ACE/js/html5shiv.js"></script>
		<script src="${basePath}/ACE/js/respond.min.js"></script>
		<![endif]-->
</head>
<body>
    <div class="main-container" id="main-container">
        <div class="main-container-inner">
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li><i class="icon-home home-icon"></i><a href="welcome.htm" >首页</a> </li>
                    <li><a href="#">用户管理</a> </li>
                    <li class="active">用户列表</li>
                </ul>
                <!-- .breadcrumb -->
            </div>
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="col-xs-12">
                            <!-- PAGE CONTENT BEGINS -->
                            <form  action="" method="post">
                            <div>
                                <input type="text" placeholder="用户名"  name="uname" class="width-20"  value="${param.uname }"/>
                                <input type="text" placeholder="手机号码" name="phone" class="width-20"  value="${param.phone }"/>
                                <input type="text" placeholder="出生日期" name="birthday" class="width-20" value="${param.birthday }" />
                                <input type="hidden" name="pageIndex" value="${page.pageIndex }" />                                
                                <input type="submit" value="检索" class="btn btn-primary btn-sm" />

                            </div>
                            </form>
                            <div class="hr-12"></div>
                            <div>
                            <a href="" class="btn" id="deleteAll">批量删除</a>
                            <a href="${basePath }/employer/exportExcel.do" class="btn">导出Excel</a>
                                <table class="table table-hover table-bordered">
                                    <thead>
                                        <tr>
                                            <th><input type="checkbox" name="" id="selectAll"/>序号</th>
                                            <th>用户名</th>
                                            <th>头像</th>
                                            <th>手机号码</th>
                                            <th>邮箱地址</th>
                                            <th>年龄(生日)</th>
                                            <th>入职时间</th>
                                            <th>操作列</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach items="${page.data }" var="em" varStatus="staus">
                                        <tr>
                                            <td><input type="checkbox" name="eid" value="${em.e_id }"/>${staus.count+(page.pageIndex-1)*page.pageSize }</td>
                                            <td><a href="#">${em.e_name }</a></td>
                                            <td><img src="${em.e_img }" alt="${em.e_name }" height="30px"/></td>
                                            <td>${em.e_phone }</td>
                                            <td>${em.e_email }</td>
                                            <td><fmt:formatDate value="${em.e_birthday }" pattern="yyyy-MM-dd"/></td>
                                            <td><fmt:formatDate value="${em.e_joinday }" pattern="yyyy-MM-dd"/></td>
                                            <td>
                                                <a href="${basePath }/employer/update.do?id=${em.e_id }"><i class="icon-edit"></i>修改</a>&nbsp;&nbsp;
                                                <a href="${basePath }/employer/delete.do?id=${em.e_id }" onclick="return confirm('确认删除?')"><i class="icon-remove"></i>删除</a>&nbsp;&nbsp;
                                                <a href="" data="${em.e_id }" class="reset"><i class="icon-info"></i>重置密码</a>
                                            </td>
                                        </tr>
                                      </c:forEach>                                         
                                    </tbody>
                                </table>                                
                                <div class="page">
                                	<a href="" class="btn" data="1">首页</a>
                                	<a href="" class="btn" data="${page.pageIndex-1<1?1:page.pageIndex-1 }">上一页</a>
                                	<a href="" class="btn" data="${page.pageIndex+1>page.totalPage?page.totalPage:page.pageIndex+1}">下一页</a>
                                	<a href="" class="btn" data="${page.totalPage }">尾页</a>
                                </div>
                            </div>
                            <!-- PAGE CONTENT ENDS -->
                        </div>
                        <!-- /.col -->
                    </div>
                    <!-- /.row -->
                </div>
                <!-- /.page-content -->
            </div>
            <!-- /.main-container-inner -->
            <a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse"><i class="icon-double-angle-up icon-only bigger-110">
            </i></a>
        </div>
        <!-- /.main-container -->
        <script src='${basePath}/ACE/js/jquery-2.0.3.min.js' type="text/javascript"></script>
        <script type="text/javascript">
            if ("ontouchend" in document) document.write("<script src='${basePath}/ACE/js/jquery.mobile.custom.min.js'>" + "<" + "/script>");
        </script>
        <script src="${basePath}/ACE/js/bootstrap.min.js" type="text/javascript"></script>
        <script src="${basePath}/ACE/js/typeahead-bs2.min.js" type="text/javascript"></script>
        <script src="${basePath}/ACE/js/ace-elements.min.js" type="text/javascript"></script>
        <script src="${basePath}/ACE/js/ace.min.js" type="text/javascript"></script>
        <script type="text/javascript">
           $(function(){
        	   $(".page>a").click(function(event){
        		   event.preventDefault();        		   
        		   var page=$(this).attr("data");        		   
        		   $("input[name='pageIndex']").val(page);
        		   $("form").submit();        		   
        	   });
        	   
        	   //提交表单 
        	   $("input:submit").click(function(event){
        		   event.preventDefault();  
        		   $("input[name='pageIndex']").val(1);
        		   $("form").submit();           		   
        	   });
        	   
        	   
        	   //重置密码  ..... 
        	   $("a.reset").click(function(event){
        		   event.preventDefault();
        		   var url="${basePath}/employer/resetPass.do";
        		   var id=$(this).attr("data");
        		   $.getJSON(url,"id="+id,function(data){
        			   if(data){
        				   alert("重置成功,密码为00000");
        			   }else{
        				   alert("重置密码失败......");
        			   }        			   
        		   });  
        		   
        		   
        	   });
        	   
        	   
        	   //全选 反选 进行批量删除用户的信息.....
        	   $("#selectAll").click(function(){
        		   if(this.checked){
        			   $("tbody input:checkbox").prop("checked",true);
        		   }else{
        			   $("tbody input:checkbox").prop("checked",false);        			   
        		   }        		   
        	   });
        	   
        	   //删除所有选中的用户....
        	   $("#deleteAll").click(function(event){
        		   event.preventDefault();
        		   var ids=[];
        		   $("tbody input:checked").each(function(index,item){
        			   ids.push(this.value);        			   
        		   });
        		    ids= ids.join(",");
        		    //跳转到批量删除的页面 
        		    location.href="${basePath}/employer/deleteAll.do?ids="+ids;
        		   
        	   });
        	   
        	   
           });
        </script>
</body>
</html>
